@extends('app')

@section('content')

<link href="{{ asset('/css/spinners.css') }}" rel="stylesheet">

<div id="grid" class="grid" style="position: fixed;z-index: 1000;left:50%;display: none;">
    <div class="cell">
        <div class="card">
            <span class="throbber-loader">Loading…</span>
        </div>
    </div>
</div>

<ul class="nav nav-tabs">
    <li class="active"><a href="{{ url('/admin/user')}}">信息列表</a></li>
    <li><a href="{{ url('/admin/user/user-add')}}">用户添加</a></li>
</ul>

<div class="panel panel-default mt20">

    <div class="table-responsive panel-body">
        <table class="table table-hover">
            <thead>
            <tr>
                <th>编号</th>
                <th>用户名称</th>
                <th>用户组</th>
                <th>是否组长</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach($users as $res)
            <tr id="news_{{ $res->id }}">
                <td>{{ $res->id }}</td>
                <td><a href="{{ url('/admin/user/user-edit/'.$res->id) }}">{{ $res->name }} </a></td>
                <td>
                    @if($res->group_id == '0')
                        @if($res->role_id == 2)
                            业绩管理员
                        @else
                            考勤管理员
                        @endif
                    @else
                        {{ getGroupName($res->group_id) }}
                    @endif
                </td>
                <td>
                    @if($res->is_leader == '1')
                        组长
                    @else
                        组员
                    @endif
                </td>
                {{--<td id="disabled">
                    @if($res->is_active == 0)
                    <span class="glyphicon glyphicon-ok-circle  green-remove" alt="正常"></span>
                    @else
                    <span class="glyphicon glyphicon-remove-circle red-ok" alt="失效"></span>
                    @endif
                </td>--}}
                <td>
                    <a href="{{ url('/admin/user/user-edit/'.$res->id) }}"><i class="glyphicon glyphicon-edit"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="javascript:void(0);" onclick="delete_one('/admin/user/user-delete/{{$res->id}}','{{$res->id}}','{{ csrf_token() }}')"><i class="icon-remove-sign"></i></a>
                </td>
            </tr>
            @endforeach
            </tbody>
        </table>
    </div>
    <div>{!! $users->render() !!} </div>
</div>
<script>
    $('.list-group-item').eq(2).addClass('active');
</script>
@endsection
